import com.badlogic.gdx.ApplicationAdapter
import com.badlogic.gdx.Gdx
import com.badlogic.gdx.backends.lwjgl.LwjglApplication
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.BitmapFont
import com.badlogic.gdx.graphics.g2d.SpriteBatch

fun main(args: Array<String>)
{
    LwjglApplication(MainPage(), config {
        width = 480
        height = 320
        useGL20 = true
        backgroundFPS = 30
        foregroundFPS = 120
        initialBackgroundColor = Color.GRAY
        resizable = false
        title = "HieroDemo"
    })
}

class MainPage : ApplicationAdapter()
{
    private val font by lazy { BitmapFont(Gdx.files.internal("hello.fnt"), false) }
    private val batch by lazy { SpriteBatch() }

    override fun create()
    {
        font.color = Color.RED
        font.scale(0.0f)
    }

    override fun render()
    {
        clear(0, 0, 0)
        batch.begin()
        font.drawMultiLine(batch,"你认我做大哥，\n我教你梳中分",50f, Gdx.graphics.floatHeight / 2)
        //font.draw(batch, "你认我做大哥，我教你梳中分", 50f, Gdx.graphics.floatHeight / 2)
        batch.end()
    }

}